package com.power.ding.model;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.plf.core.common.annotations.FieldEnumText;
import com.plf.core.common.domain.BaseModel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.*;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
*  钉钉消息发送实体类
*/

@Entity
@ApiModel(value="钉钉消息发送")
@Data
@Table(name="Di_message")
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
//@IdClass(Di_message.Di_messagePK.class) 用于复合组件
public class Di_message extends BaseModel implements Serializable {
	
	private static final long serialVersionUID = 1L;
	
    @Id
    @Setter(AccessLevel.NONE)
    @ApiModelProperty(value = "序号")
    private String id;

    @ApiModelProperty(value = "发送人id")
    private String sendUserId;

    @ApiModelProperty(value = "发送人姓名")
    private String sendUserName;

    @Column(nullable = false)
    @ApiModelProperty(value = "接收人ids")
    private String receiveUserId;

    @ApiModelProperty(value = "接收人姓名s")
    private String receiveUserName;

    @Column(nullable = false)
    @ApiModelProperty(value = "消息内容")
    private String content;

    @ApiModelProperty(value = "消息详情地址")
    private String actUrl;

    @Column(nullable = false)
    @ApiModelProperty(value = "提醒方式")
    private Integer remindType;

    @ApiModelProperty(value = "发送时间", example="2020-10-22 10:03:22")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date sendTime;

    @ApiModelProperty(value = "发送失败错误提示")
    private String sendError;

    @ApiModelProperty(value = "统一消息平台id")
    private String remoteid;


    public Map<String, Object> parseMap() {
        Map<String, Object> map=new HashMap<>();
        map.put("id", this.getId());
        map.put("sendUserId", this.getSendUserId());
        map.put("sendUserName", this.getSendUserName());
        map.put("receiveUserId", this.getReceiveUserId());
        map.put("receiveUserName", this.getReceiveUserName());
        map.put("content", this.getContent());
        map.put("actUrl", this.getActUrl());
        map.put("remindType", this.getRemindType());
        map.put("sendTime", this.getSendTime());
        map.put("sendError", this.getSendError());
        map.put("remoteid", this.getRemoteid());
        return map;
    }

    public String getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = (String) id;
    }

    public Serializable getPrimaryKey() {
        return id;
        // return new Di_messagePK(id, id2); 用于复合主键，请手动创建内部静态类
    }

    public void setPrimaryKey(Serializable key) {
        this.id = (String)key;

        //Di_messagePK pk = (Di_messagePK) key; 用于复合主键
        //this.id = pk.getId();
        //this.id2 = pk.getId2();
    }

}